import {getUserProfile} from '../../service/api_login'
Page({

	data: {
		userInfo: {},
		isShow: true
	},

	onLoad(options) {
		const userinfo = wx.getStorageSync('userinfo') || undefined
		if(userinfo !== undefined) {
			const userInfo = JSON.parse(userinfo) 
			this.setData({isShow: false,userInfo})
		}
	},
	// 对用户信息进行处理
	async handleGetterInfo() {
		const userInfo = await getUserProfile()
		console.log(userInfo);
		wx.setStorageSync('userinfo', JSON.stringify(userInfo))
		this.setData({isShow: false, userInfo})
	},
	// 退出登录 
	handleExitClick() {
		wx.showToast({title: '退出成功'})
		this.setData({isShow: true, userInfo: {}})
		wx.removeStorageSync('userinfo')
	},
	// 获取手机信息
	// getPhoneNumber (e) {
  //   console.log(e.detail.errMsg)
  // }
})